<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TypeTacheManager
 *
 * @author camara
 */
include_once '../model/TypeTache.php';

class TypeTacheManager {
    
    private $bdd;
    
    function __construct($bdd) {
        $this->bdd = $bdd;
    }
    
    public function getListTypeTache($cat){

        $listtype = array();
        $req = $this->bdd->prepare("SELECT * FROM TYPETACHE WHERE idCat=$cat");
        $req->execute();
        while ($donnees = $req->fetch()){
            $type = new TypeTache($donnees["idType"],$donnees["libelle"]);
            array_push($listtype, $type);
        }
        
        return $listtype;
    }
    
    
    public function getLibelletypebyId($id){
        
        $req = $this->bdd->prepare('SELECT libelle FROM TYPETACHE  WHERE idType = ?');
        $req->execute(array($id));
        while ($donnees = $req->fetch()){
           $libelle = $donnees["libelle"];
        }
        return $libelle;
        
    }
}
